package com.micmac.main.view.compenents
{
	
	/*
	
	Author : Roy Raul.
	
	Component : MainMediator             
	
	Version History         : 0.1 Date Jul-20-2011
	
	Current Version         : 0.1 Date Jul-20-2011
	
	Build Date              : Apr-14-2010
	
	*/
	
	import com.AppConst;
	import com.micmac.main.events.MainEvent;
	
	import flash.events.Event;
	import flash.net.registerClassAlias;
	
	import mx.controls.Alert;
	
	import org.robotlegs.mvcs.Mediator;
	
	
	
	public class MainMediator extends Mediator
	{
		
		[Inject]
		public var visi:Visi;
		public function MainMediator()
		{
			super();
		}
		override public function onRegister():void{
			
			eventMap.mapListener(eventDispatcher, MainEvent.INDEX_CHANGED, onIndexChange);
			eventMap.mapListener(eventDispatcher, AppConst.RESOURCE_LOADING_COMPLETE, onResourceLoaded, Event);
		}
		private function onIndexChange(event:MainEvent):void{
			
			visi.vsMainViewStack.selectedIndex = event.viewIndex;
		}
		
		private function onResourceLoaded(e:Event):void
		{
			visi.vsMainViewStack.selectedIndex = 1;
		}
		
		
	}
}